package com.kxxnzstdsw.schedule.job

import com.kxxnzstdsw.schedule.ScheduleJob
import io.github.oshai.kotlinlogging.KotlinLogging
import org.quartz.*

@ScheduleJob
class HelloJob : BasicJob {
  val logger = KotlinLogging.logger { }
  override val job: JobDetail = JobBuilder
    .newJob(this::class.java)
    .withIdentity(this::class.simpleName)
    .build()

  override val trigger: Trigger = TriggerBuilder
    .newTrigger()
    .withSchedule(
      CronScheduleBuilder
        .cronSchedule("0/1 * * * * ?")
    )
    .withIdentity(this::class.simpleName)
    .forJob(job)
    .build()

  override fun execute(context: JobExecutionContext?) {
    logger.info { "HelloJob" }
  }
}
